package com.example.xyxwebbackend001.model.DTO;

import com.example.xyxwebbackend001.model.enums.TagEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ArticleSimpleDTO {
    private Long id;
    private String title;
    private String coverImage;
    private String summary;
    private Integer tags;
    private String tagsName;
    public void convertTagToName() {
        if (this.tags != null) {
            TagEnum tagEnum = TagEnum.getByCode(this.tags);
            this.tagsName = (tagEnum != null) ? tagEnum.getName() : "未知标签";
        } else {
            this.tagsName = "未分类";
        }
    }
}